using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;
using Backend.JYD.Model.Task;

namespace Backend.JYD.EFDAL.Mapping
{
    public class TaskModelMap : EntityTypeConfiguration<TaskModel>
    {
        public TaskModelMap()
        {
            // Primary Key
            this.HasKey(t => t.TaskModeId);

            // Properties
            this.Property(t => t.TaskModeId)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);

            this.Property(t => t.TaskName)
                .IsRequired()
                .HasMaxLength(50);

            this.Property(t => t.RoleIds)
                .HasMaxLength(50);

            this.Property(t => t.EmpIds)
                .HasMaxLength(50);

            // Table & Column Mappings
            this.ToTable("TaskModel");
            this.Property(t => t.TaskModeId).HasColumnName("TaskModeId");
            this.Property(t => t.TaskName).HasColumnName("TaskName");
            this.Property(t => t.RoleIds).HasColumnName("RoleIds");
            this.Property(t => t.EmpIds).HasColumnName("EmpIds");
            this.Property(t => t.Type).HasColumnName("Type");
            this.Property(t => t.Status).HasColumnName("Status");
            this.Property(t => t.CreateTime).HasColumnName("CreateTime");
            this.Property(t => t.UpdateTime).HasColumnName("UpdateTime");
            this.Property(t => t.OpId).HasColumnName("OpId");
        }
    }
}
